﻿using System;
using System.Collections.Generic;
using System.Threading;

namespace ArgusLib.Threading
{
	public class ThreadState
	{
		public bool CancelRequested { get; private set; }
		//public bool Cancelled{get;private set;}
		//public object Result { get; set; }
		public object[] Arguments { get;private set; }
		private object _lock;

		private ThreadState()
		{
			this._lock = new object();
			//this.Result = null;
			this.CancelRequested = false;
			//this.Cancelled = false;
		}

		public ThreadState(params object[] arguments)
			: this()
		{
			this.Arguments = arguments;
		}

		public void RequestCancel()
		{
			if (this.CancelRequested == true)
				return;
			lock (this._lock)
			{
				this.CancelRequested = true;
			}
		}
	}
}
